/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;


/**
 *
 * @author Mario
 */
public class Money{

    private  int fAmount;
    private String fCurrency;

    public Money(int amount, String currency) {

        this.fAmount = amount;
        this.fCurrency = currency;
    }



    public Money add(Money m){

        return new Money(getAmount()+m.getAmount(), getCurrency());
    }


    @Override
    public boolean equals(Object anObject) {

        if (anObject instanceof Money) {
            Money aMoney= (Money)anObject;
            return aMoney.getCurrency().equals(getCurrency())
                && getAmount() == aMoney.getAmount();
            }
    return false;
}

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 37 * hash + this.fAmount;
        hash = 37 * hash + (this.fCurrency != null ? this.fCurrency.hashCode() : 0);
        return hash;
    }
    
    public int getAmount() {
        return fAmount;
    }

    public String getCurrency() {
        return fCurrency;
    }

}
